package com.potenza.business.filter;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

@Component
public class TestFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("doFilter  Before--------" + servletRequest.getContentType());

        filterChain.doFilter(servletRequest,servletResponse);//执行后期业务逻辑

        System.out.println("doFilter  After " + servletResponse.getContentType());
    }

    @Override
    public void destroy() {

    }
}
